# encoding: UTF-8

class Node < ActiveRecord::Base
 
  has_many :topics

  attr_accessible :status, :title, :category

  scope :open_status, where(:status => 0)

  validates_presence_of :title, :message => '分类名称为必填项'
  validates_uniqueness_of :title, :message => '此分类标题已经存在'

  scope :open_status, where( :status => 0 )
  scope :off_status, where( :status => 1 )
  scope :topic_category, where( :category => 1 )
  scope :photo_category, where( :category => 2 )

end
